{include file="public/layout"/}
<body data-type="generalComponents">
<div class="tpl-content-wrapper js-check-wrap">
    <ol class="am-breadcrumb">
        <li><a href="javascript:void(0)" class="am-icon-home" onclick="javascript:parent.openItem('welcome|Index');">首页</a></li>
        <li class="am-active">数据</li>
        <li class="am-active">数据还原</li>
    </ol>
    <div class="tpl-portlet-components">
        <div class="tpl-block ">
            <div class="am-g tpl-amazeui-form">
                <div class="am-u-sm-12 am-u-md-9">
                    <form class="am-form am-form-horizontal" action="{:url('Tools/restoreUpload')}" method="post" enctype="multipart/form-data">
                        <div class="am-form-group am-form-file">
                            <label class="am-u-sm-3 am-form-label">本地sql文件</label>
                            <div class="am-u-sm-9">
                                <button type="button" class="am-btn am-btn-danger am-btn-sm">
                                    <i class="am-icon-cloud-upload"></i> 选择要上传的文件</button>
                                <input id="doc-form-file" type="file" name="sqlfile">
                                <div id="file-list"></div>
                            </div>
                        </div>

                        <div class="am-form-group">
                            <div class="am-u-sm-9 am-u-sm-push-3">
                                <button type="submit" class="am-btn am-btn-primary">上传并执行sql文件</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <div class="tpl-portlet-components">
        <div class="tpl-block">
            <form class="js-ajax-form" method="post">
                <div class="am-g">
                    <div class="am-u-sm-12 am-u-md-6">
                        <div class="am-btn-toolbar">
                            <div class="am-btn-group am-btn-group-xs">
                                {$action|actionList|raw}
                            </div>
                        </div>
                    </div>
                </div>
                <div class="am-g">
                    <div class="am-u-sm-12">
                        <form class="am-form">
                            <table class="am-table am-table-striped am-table-hover table-main">
                                <thead>
                                <tr>
                                    <th class="table-check"><input type="checkbox" class="tpl-table-fz-check js-check-all" data-direction="x" data-checklist="js-check-x"></th>
                                    <th class="table-title">文件名称</th>
                                    <th class="table-title am-hide-sm-only">卷号</th>
                                    <th class="table-type am-hide-sm-only">压缩</th>
                                    <th class="table-author">数据大小</th>
                                    <th class="table-date">备份时间</th>
                                    <th class="table-set am-hide-sm-only">状态</th>
                                    <th class="table-set">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                {foreach name="list" item="vo" key="k" }
                                <tr>
                                    <td><input type="checkbox" class="js-check"  data-yid="js-check-y" data-xid="js-check-x" name="time[]" value="{$vo['time']}"></td>
                                    <td>{$vo.basename}</td>
                                    <td class="am-hide-sm-only">{$vo.part}</td>
                                    <td class="am-hide-sm-only">{$vo.compress}</td>
                                    <td>{$vo.size|format_bytes}</td>
                                    <td>{$vo.time|date="Y-m-d H:i:s"}</td>
                                    <td class="am-hide-sm-only">-</td>
                                    <td>
                                        <div class="am-btn-toolbar">
                                            <div class="am-btn-group am-btn-group-xs">
                                                <a class="am-btn am-btn-default am-btn-xs am-text-secondary js-ajax-delete" data-msg="确定要还原吗？" href="{:url('import?time='.$vo['time'])}"><i class="am-icon-repeat"></i> 还原</a>
                                                <a class="am-btn am-btn-default am-btn-xs am-text-secondary" href="{:url('Tools/downFile',array('time'=>$vo['time']))}"><i class="am-icon-cloud-download"></i> 下载</a>
                                                <a class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only js-ajax-delete" href="{:url('tools/del', array('time'=>$vo['time']))}" data-msg="确定要删除吗？"><i class="am-icon-trash-o"></i> 删除</a>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                {/foreach}
                                </tbody>
                            </table>
                        </form>
                    </div>

                </div>
            </form>
        </div>
    </div>
</div>
<script src="__ADMIN__/js/admin.js"></script>
<script>
    $(function() {
        $('#doc-form-file').on('change', function() {
            var fileNames = '';
            $.each(this.files, function() {
                fileNames += '<span class="am-badge">' + this.name + '</span> ';
            });
            $('#file-list').html(fileNames);
        });
    });
</script>
</body>
</html>